package cn.tianwt.proxy.http.utils;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class ThreadPoolManager {

	private  ExecutorService sExecutorService;
	private static ThreadPoolManager thisInstance;
	
	private ThreadPoolManager() {
		sExecutorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()*2+1);
	}
	
	public static ThreadPoolManager get(){
		
		if(thisInstance==null) {
			synchronized (ThreadPoolManager.class) {
				thisInstance = new ThreadPoolManager();
			}
		}
		return thisInstance; 
	}
	
	public  void execute(Runnable task) {
		sExecutorService.execute(task);
	}


	
}
